﻿@model PlmTurnoverViewModel
@{
    Layout = null;
    ViewBag.Title = "人员变动申报列表";
}

<div class="page" style="border-top: 1px solid #b8d0d6;" layouth="1">
    @using (Html.BeginForm("SplitPage", "PlmTurnover", null, FormMethod.Post, new { id = "pagerForm", onsubmit = "return navTabSearch(this);" }))
    {
        <input type="hidden" name="pageNum" value="1" />
        <input type="hidden" name="numPerPage" value="@(ViewBag.numPerPage)" />
        <ul class="searchBar">
            <li><span>姓名：</span>
                <input type="text" name="Sname" value="@(ViewBag.Sname)" />
            </li>
            <li><span>所属标段：</span>
                <input type="text" name="sectionname" value="@(ViewBag.sectionname)" />
            </li>
            <li><span>变动职位：</span>
                <input type="text" name="positionname" value="@(ViewBag.positionname)" />
            </li>
            <li><span>申报日期：</span>
                <input type="text" name="reporttime" class="date" value="@(ViewBag.reporttime)" />
            </li>
            <li>
                <button type="submit" class="btn btn-success btn-xs">
                    搜索</button>
            </li>
            @*<li><a class="button" href="@Url.Action("TurnoverAdd", "PlmTurnover")" target="navTab" title="添加"><span>添加</span></a></li>*@
        </ul>
    }
    <div class="panelBar" style="border-top: none;">
        <ul class="toolBar">
            <li>@Html.PermissionButton("PersonnelLog.PlmTurnover.Create", "PersonnelLog_PlmTurnover_Add", "add",
               Url.Action("TurnoverAdd", "PlmTurnover", new { Section = ViewBag.Section, numPerPage= ViewBag.numPerPage }), "", "dialog", "添加", "true", "480", "480", "添加")
            </li>
            <li>
                @Html.PermissionButton("PersonnelLog.PlmTurnover.Delete", "PersonnelLog_PlmTurnover_Delete",
                    Url.Action("TurnoverDelete", "PlmTurnover", new { id = "{ids}" }),
                    "删除",
                    new Dictionary<string, object>
                    {
                        {"class","delete"} ,{"target","ajaxTodo"},{"title","确定要删除该条记录吗?"},{"callback","function(){$('#pagerForm', navTab.getCurrentPanel()).submit();}"}
                    })
            </li>
            <li>@Html.PermissionButton("PersonnelLog.PlmTurnover.Edit", "PersonnelLog_PlmTurnover_Edit",
                    Url.Action("TurnoverEdit", "PlmTurnover", new { id = "{ids}" }),
                    "修改",
                    new Dictionary<string, object>
                    {
                        {"class","edit"} ,{"mask","true"},{"target","dialog"},{"width","480"},{"height","480"},{"rel","dlg_aqsc_edit"},{"warn","请选择一条信息"}
                    })
            </li>
            <li>
                @Html.PermissionButton("PersonnelLog.PlmTurnover.Detail", "PersonnelLog_PlmTurnover_Detail",
                    Url.Action("TurnoverDetail", "PlmTurnover", new { id = "{ids}" }),
                    "查看",
                    new Dictionary<string, object>
                    {
                        {"class","detail"},{"rel","rygl_jlry_detail"} ,{"warn","请选择一条信息！"},{"target","dialog"},{"mask","true"},{"width","640"},{"height","480"}
                    })
            </li>
            <li>
                @Html.PermissionButton("PersonnelLog.PlmTurnover.Audit", "PersonnelLog_PlmTurnover_Audit",
                    Url.Action("TurnoverCheckAudit", "PlmTurnoverCheck", new { id = "{ids}" }),
                    "审批",
                    new Dictionary<string, object>
                    {
                        {"class","check"},{"rel","listAuditId"} ,{"warn","请选择一条信息！"},{"target","dialog"},{"mask","true"},{"width","400"},{"height","320"}
                    })
            </li>
            <li class="line">line</li>
        </ul>
    </div>
    <table class="table" width="100%" layouth="122">
        <thead>
            <tr>
                <th width="22" style="display:none">
                    <input type="checkbox" group="ids" class="checkboxCtrl">
                </th>
                <th align="center">
                    序号
                </th>
                <th align="center">
                    变动职位
                </th>
                <th align="center">
                    所属标段
                </th>
                <th align="center">
                    现职人员
                </th>
                <th align="center">
                    变更人员
                </th>
                <th align="center">
                    申报日期
                </th>
                <th align="center">
                    变动类型
                </th>
                <th align="center">
                    状态
                </th>
                @*<th align="center">操作</th>*@
            </tr>
        </thead>
        <tbody>
            @{ int num = (ViewBag.pageNum - 1) * ViewBag.numPerPage;}
            @foreach (var item in Model.ThePlmTurnoverInfoList)
            {
                num += 1;
                <tr target="ids" rel="@item.T_ID" data-turnover="true" data-state="@item.T_State" >
                    <td style="display:none">
                        <input name="ids" value="@item.T_ID" type="checkbox">
                    </td>
                    <td>@num
                    </td>
                    <td>@item.T_Position
                    </td>
                    <td>@item.T_SectionName
                    </td>
                    <td>@item.T_ExistingStaff
                    </td>
                    <td>@item.T_ChangePersonnel
                    </td>
                    <td>@item.T_DeclarationDate.ToString("yyyy-MM-dd")
                    </td>
                    <td>@item.T_Type
                    </td>
                    <td>@item.T_State
                    </td>
                </tr>
            }
        </tbody>
    </table>
    <div class="panelBar" style="border-bottom: none;">
        <div class="pages" style="float: right">
            <span>显示</span>
            <select class="comsplitpage" id="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
                <option value="10" @(ViewBag.numPerPage == 10 ? "selected='selected'" : "")>10</option>
                <option value="20" @(ViewBag.numPerPage == 20 ? "selected='selected'" : "")>20</option>
                <option value="50" @(ViewBag.numPerPage == 50 ? "selected='selected'" : "")>50</option>
            </select>
            <span>条，共@(ViewBag.pagenumshown)页,@(ViewBag.totalcount)条</span>
        </div>
        <div class="pagination" style="margin:0px;float:left; margin-left:35%" targettype="navTab" totalcount="@(ViewBag.totalcount)" numperpage="@(ViewBag.numPerPage)" pagenumshown="10" currentpage="@(ViewBag.pageNum)">
        </div>
    </div>
</div>
<script>
    $.jTableTool.clickRowAction(function ($row) {
        if ($row) {
            debugger;
            var isCheck = $row.data("turnover");
            var state = $row.data("state");

            if (isCheck) {
                //已审核隐藏修改、删除
                if (state != "待审核") {
                    //已经审核了
                    $("#PersonnelLog_PlmTurnover_Delete").hide();
                    $("#PersonnelLog_PlmTurnover_Edit").hide();
                    $("#PersonnelLog_PlmTurnover_Audit").hide();


                } else {
                    $("#PersonnelLog_PlmTurnover_Delete").show();
                    $("#PersonnelLog_PlmTurnover_Edit").show();
                    $("#PersonnelLog_PlmTurnover_Audit").show();

                }
            }
        }
    });
</script>
